package com.example.administrator.videotest2.util.Tab;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.administrator.videotest2.R;
import com.example.administrator.videotest2.util.AlipayUtil;
import com.example.administrator.videotest2.util.SharePopupWindow;

public class Tab_4Activity extends AppCompatActivity implements View.OnClickListener{

    private View sc;
    private View help;
    private View update;
    private View fx;
    private View set;
    private View pay;
    private LinearLayout mLayoutRoot;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tab_4);
        sc=findViewById(R.id.sc);
        help=findViewById(R.id.help);
        update=findViewById(R.id.update);
        fx=findViewById(R.id.fx);
        pay=findViewById(R.id.pay);
        set=findViewById(R.id.set);
        sc.setOnClickListener(this);
        help.setOnClickListener(this);
        update.setOnClickListener(this);
        fx.setOnClickListener(this);
        set.setOnClickListener(this);
        pay.setOnClickListener(this);
        mLayoutRoot=(LinearLayout) findViewById(R.id.foot1);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()){
            case R.id.sc: break;
            case R.id.help: break;
            case R.id.update: break;
            case R.id.fx:
                String shareContent="http://139.199.23.9:8080/digua.apk";
                SharePopupWindow spw = new SharePopupWindow(this, shareContent);
                // 显示窗口
                spw.showAtLocation(mLayoutRoot, Gravity.BOTTOM, 0, 0);

                break;
            case R.id.set:
                break;
            case R.id.pay:
                awarAuthor();
                break;
            default:break;
        }
    }
    public void awarAuthor(){
        if(AlipayUtil.hasInstalledAlipayClient(Tab_4Activity.this)){
            AlipayUtil.startAlipayClient(Tab_4Activity.this, "FKX01269HAKPLAB4YRGR13");  //第二个参数代表要给被支付的二维码code  可以在用草料二维码在线生成
        }else{
            Toast.makeText(Tab_4Activity.this,"nonono",Toast.LENGTH_SHORT).show();
        }
    }
}
